**************************************************************************************************
*** This do file creates the replication results for 
*** Adoption and Compliance in Second-Hand Smoking Bans: A Global Econometric Analysis	 					 	*/
*** Richard Perkins (LSE)														*/
*** Eric Neumayer (LSE)																			*/
*** 																							*/
*** Published in: International Journal of Public Health, 59 (5), 2014, pp. 859-866 													*/
**************************************************************************************************
**************************************************************************************************
/* Note: 
You have to change "local DIR" to the directory you copy the original stata files contained 	*/
/* in the zip file and then run the do file. 													*/
**************************************************************************************************

version 12.0
drop _all
clear matrix
clear mata


capture net install outreg2, from(http://fmwww.bc.edu/RePEc/bocode/o)			/* checks whether outreg2 is installed 		*/

***********************************************************************************
local DIR = "d:\Research\Health for all database\Smoking bans\"  /*change relative path to the directory where the files are located */
cd "`DIR'"
***********************************************************************************

use "Article for IJPH (smoking).dta", replace

/*
P1	National smoking ban in HEALTH-CARE FACILITIES
P2	National smoking ban in EDUCATIONAL FACILITIES EXCEPT UNIVERSITIES
P3	National smoking ban in UNIVERSITIES
P4	National smoking ban in GOVERNMENT FACILITIES
P5	National smoking ban in INDOOR OFFICES
P6	National smoking ban in RESTAURANTS
P7	National smoking ban in PUBS AND BARS
P8	National smoking ban in PUBLIC TRANSPORT
P9	National smoking ban in ALL OTHER INDOOR PUBLIC PLACES
*/


capture dropvars smoke_ban_health smoke_ban_edu smoke_ban_government smoke_ban_offices smoke_ban_pubtransport

gen smoke_ban_health=0
replace smoke_ban_health=1 if p1=="Yes"

gen smoke_ban_edu=0
replace smoke_ban_edu=1 if p2=="Yes" | p3=="Yes"

gen smoke_ban_government=0
replace smoke_ban_government=1 if p4=="Yes"

gen smoke_ban_offices=0
replace smoke_ban_offices=1 if p5=="Yes"

gen smoke_ban_pubtransport=0
replace smoke_ban_pubtransport=1 if p8=="Yes"

** Fill missing demographic structure data with data from CIA World Fact Book
replace pop_15_64=70.9 if wb_country_name=="Seychelles"
replace pop_65up=7.3 if wb_country_name=="Seychelles"
replace pop_15_64=70.9 if wb_country_name=="Palau"
replace pop_65up=6.8 if wb_country_name=="Palau"
replace pop_15_64=66.7 if wb_country_name=="Antigua and Barbuda"
replace pop_65up=7.1 if wb_country_name=="Antigua and Barbuda"
replace pop_15_64=68.7 if wb_country_name=="Dominica"
replace pop_65up=10.4 if wb_country_name=="Dominica"
replace pop_15_64=63.1 if wb_country_name=="Kiribati"
replace pop_65up=3.9 if wb_country_name=="Kiribati"
replace pop_15_64=68.4 if wb_country_name=="St. Kitts and Nevis"
replace pop_65up=7.8 if wb_country_name=="St. Kitts and Nevis"

** Change the scale of tobacco production variable
replace tobacco_production_filled0=tobacco_production_filled0/1000

capture mi extract 0, clear
mi set wide
mi register imputed cigarette_consumption  health_exp_to_gov_exp ln_gdp_pc
capture mi xtset, clear
capture mi stset, clear
mi impute mvn ln_gdp_pc  cigarette_consumption health_exp_to_gov_exp = smoke_ban_rest_or_bars_who smoke_ban_health smoke_ban_edu smoke_ban_government smoke_ban_offices smoke_ban_pubtransport rule_law_est   tobacco_production_filled0 developed- reg_lac  pop_t- life_exp,  add(100) replace force rseed(2232)



** Smoking ban incidence (existing sample)
* Ban in restaurants OR bars (NOTE: practically no difference to ban in restaurant only or bar only or ban in both)
probit  smoke_ban_rest_or_bars_who  cigarette_consumption  ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp, robust
margins, at( (p25) ln_gdp_pc) 
margins, at( (p75) ln_gdp_pc) 
margins, dydx(*) post
outreg2 using table1, replace excel ci level(95) 2aster  dec(2) sideway

ivprobit  smoke_ban_rest_or_bars_who   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
margins, at( (p25) ln_gdp_pc)  predict(pr)
margins, at( (p75) ln_gdp_pc)  predict(pr)
margins, dydx(*) post  predict(pr)
outreg2 using table1, append excel ci level(95) 2aster  dec(2) sideway


capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
	probit  smoke_ban_rest_or_bars_who  cigarette_consumption  ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp, robust
  margins, dydx(*)  predict(pr) post
end
mi estimate, cmdok: mimargins 1

capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
	probit  smoke_ban_rest_or_bars_who  cigarette_consumption  ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp, robust
  margins, at( (p25) ln_gdp_pc)  predict(pr) post
end
mi estimate, cmdok: mimargins 1

capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
	probit  smoke_ban_rest_or_bars_who  cigarette_consumption  ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp, robust
  margins, at( (p75) ln_gdp_pc)  predict(pr) post
end
mi estimate, cmdok: mimargins 1


** Ban education facilities
capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_rest_or_bars_who   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, dydx(*)  predict(pr) post
end
mi estimate, cmdok: mimargins 1

capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_rest_or_bars_who   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, at( (p25) ln_gdp_pc)  predict(pr) post
end
mi estimate, cmdok: mimargins 1

capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_rest_or_bars_who   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, at( (p75) ln_gdp_pc)  predict(pr) post
end
mi estimate, cmdok: mimargins 1




** Ban health facilities
capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_health   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, dydx(*)  predict(pr) post
end
mi estimate, cmdok: mimargins 1

capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_health   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, at( (p25) ln_gdp_pc)  predict(pr) post
end
mi estimate, cmdok: mimargins 1

capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_health   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, at( (p75) ln_gdp_pc)  predict(pr) post
end
mi estimate, cmdok: mimargins 1

** Ban education facilities
capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_edu   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, dydx(*)  predict(pr) post
end
mi estimate, cmdok: mimargins 1

capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_edu   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, at( (p25) ln_gdp_pc)  predict(pr) post
end
mi estimate, cmdok: mimargins 1

capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_edu   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, at( (p75) ln_gdp_pc)  predict(pr) post
end
mi estimate, cmdok: mimargins 1



** Ban government facilities
capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_government   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, dydx(*)  predict(pr) post
end
mi estimate, cmdok: mimargins 1

capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_government   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, at( (p25) ln_gdp_pc)  predict(pr) post
end
mi estimate, cmdok: mimargins 1

capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_government   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, at( (p75) ln_gdp_pc)  predict(pr) post
end
mi estimate, cmdok: mimargins 1
capture program drop mimargins 



** Ban offices
capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_offices   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, dydx(*)  predict(pr) post
end
mi estimate, cmdok: mimargins 1

capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_offices   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, at( (p25) ln_gdp_pc)  predict(pr) post
end
mi estimate, cmdok: mimargins 1

capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_offices   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, at( (p75) ln_gdp_pc)  predict(pr) post
end
mi estimate, cmdok: mimargins 1
capture program drop mimargins 



** Ban public transport
capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_pubtransport   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, dydx(*)  predict(pr) post
end
mi estimate, cmdok: mimargins 1

capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_pubtransport   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, at( (p25) ln_gdp_pc)  predict(pr) post
end
mi estimate, cmdok: mimargins 1

capture program drop mimargins 
program mimargins, eclass properties(mi)
  version 12
  ivprobit  smoke_ban_pubtransport   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp (cigarette_consumption= pop_15_64 pop_65up ) , robust
  margins, at( (p75) ln_gdp_pc)  predict(pr) post
end
mi estimate, cmdok: mimargins 1



** Smoking ban enforcement (full sample)
ologit  smoke_ban_enforcement cigarette_consumption  ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp  smoke_ban_number yearsof_partial_rest_ban yearsof_partial_gov_ban yearsof_partial_school_ban yearsof_partial_hospital_ban yearsof_partial_transp_ban, robust
outreg2 using table3, replace excel ci level(95) 2aster  dec(2) sideway
listcoef
listcoef, reverse
listcoef, percent 
listcoef, percent reverse

ivreg2 smoke_ban_enforcement   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp  smoke_ban_number yearsof_partial_rest_ban yearsof_partial_gov_ban yearsof_partial_school_ban yearsof_partial_hospital_ban yearsof_partial_transp_ban (cigarette_consumption= pop_15_64 pop_65up) , robust first
outreg2 using table3, append excel ci level(95) 2aster  dec(2) sideway

mi estimate, post dots: ologit  smoke_ban_enforcement cigarette_consumption  ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp  smoke_ban_number yearsof_partial_rest_ban yearsof_partial_gov_ban yearsof_partial_school_ban yearsof_partial_hospital_ban yearsof_partial_transp_ban, robust
outreg2 using table3, append excel ci level(95) 2aster  dec(2) sideway

mi estimate, post dots cmdok: ivreg2 smoke_ban_enforcement   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp  smoke_ban_number yearsof_partial_rest_ban yearsof_partial_gov_ban yearsof_partial_school_ban yearsof_partial_hospital_ban yearsof_partial_transp_ban (cigarette_consumption= pop_15_64 pop_65up) , robust
outreg2 using table3, append excel ci level(95) 2aster  dec(2) sideway


** Smoking ban enforcement (non-OECD sample)
ologit  smoke_ban_enforcement cigarette_consumption  ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp  smoke_ban_number yearsof_partial_rest_ban yearsof_partial_gov_ban yearsof_partial_school_ban yearsof_partial_hospital_ban yearsof_partial_transp_ban if inc_high_oecd==0, robust
outreg2 using table4, replace excel ci level(95) 2aster  dec(2) sideway
listcoef
listcoef, reverse
listcoef, percent 
listcoef, percent reverse

ivreg2 smoke_ban_enforcement   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp  smoke_ban_number yearsof_partial_rest_ban yearsof_partial_gov_ban yearsof_partial_school_ban yearsof_partial_hospital_ban yearsof_partial_transp_ban (cigarette_consumption= pop_15_64 pop_65up)  if inc_high_oecd==0, robust first
outreg2 using table4, append excel ci level(95) 2aster  dec(2) sideway

mi estimate, post dots: ologit  smoke_ban_enforcement cigarette_consumption  ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp  smoke_ban_number yearsof_partial_rest_ban yearsof_partial_gov_ban yearsof_partial_school_ban yearsof_partial_hospital_ban yearsof_partial_transp_ban if inc_high_oecd==0, robust
outreg2 using table4, append excel ci level(95) 2aster  dec(2) sideway

mi estimate, post dots cmdok: ivreg2 smoke_ban_enforcement   ln_gdp_pc  tobacco_production_filled0 health_exp_to_gov_exp  smoke_ban_number yearsof_partial_rest_ban yearsof_partial_gov_ban yearsof_partial_school_ban yearsof_partial_hospital_ban yearsof_partial_transp_ban (cigarette_consumption= pop_15_64 pop_65up)  if inc_high_oecd==0, robust
outreg2 using table4, append excel ci level(95) 2aster  dec(2) sideway

